import { queryEnterpriseBindList } from '@/api/modules/energy'

export interface EnergyBindItem {
  energyId: number
  name: string
  energyUnit: string
  code: string
  [key: string]: any
}
export function useSelectEnergyByTenantId() {
  const [lists, setLists] = useState<EnergyBindItem[]>([])
  const [loading, setLoading] = useState(false)

  const getEnergyTypes = async () => {
    setLoading(true)
    try {
      const res = await queryEnterpriseBindList()
      setLists(res.data as EnergyBindItem[])
    }
    catch (e) {
      console.warn(e)
    }
    finally {
      setLoading(false)
    }
  }

  return { lists, loading, getEnergyTypes }
}
